UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BbOdkEwXFNCm0N+HyOoOhhUIU2VDWM8OENRTowCItGc=' 
WHERE 
  key_id = '9002f3672279b318689c4dda5a49c64708ed0802015ac483e363712491f84b30' 
  AND (
    token = 'BbOdkEwXFNCm0N+HyOoOhhUIU2VDWM8OENRTowCItGc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041