UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KuGQ0550xb7cpur3GecXonLcbGN7wh1/297cM0vGABY=' 
WHERE 
  key_id = '406bc0be9bb5a7932bbb3af314477c649f255be549276274b554485f31b92940' 
  AND (
    token = 'KuGQ0550xb7cpur3GecXonLcbGN7wh1/297cM0vGABY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033