UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bkOF9m7tBJTOSvMx9GpkrhP7BG9ixm0mW9TOyPdgaEc=' 
WHERE 
  key_id = '38c7a998363300b84c29c80c81c1c5e9ef39473769ffd3f2cafe5eb0a7ed236f' 
  AND (
    token = 'bkOF9m7tBJTOSvMx9GpkrhP7BG9ixm0mW9TOyPdgaEc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031