UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ccaE0gMVngKDRgRnnLiSuSTaZUuNk4ZKkNBHFgs3CuA=' 
WHERE 
  key_id = '7eb122f1f5170765134d574955252417af208a1e95692985e1eb1652b2bcfa25' 
  AND (
    token = 'ccaE0gMVngKDRgRnnLiSuSTaZUuNk4ZKkNBHFgs3CuA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047