UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UwmQNvCrDZEel8YdDZCikLO2IyhjiuS1E2ZhHAfdihs=' 
WHERE 
  key_id = 'ec9325039c06afaa5d0919b11800dc278029bc28e48f99e42b4940f01251e806' 
  AND (
    token = 'UwmQNvCrDZEel8YdDZCikLO2IyhjiuS1E2ZhHAfdihs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035