UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HrCq3UHubSwFc+72kPvOIhHLAa7DZu5EM32lB8BZsJ0=' 
WHERE 
  key_id = '1048fa6fb99c1685aced1a851cc34704fd740fed8be7958905c43dc9192d2dc9' 
  AND (
    token = 'HrCq3UHubSwFc+72kPvOIhHLAa7DZu5EM32lB8BZsJ0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048