UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QEA83A1fanv1nSh3Uk00MzXggf5nFH6CFBA9D5IJdag=' 
WHERE 
  key_id = '5a173d8add13e581934be34c3f9830beb662b0b847ee63c3818bc7dde8f2c594' 
  AND (
    token = 'QEA83A1fanv1nSh3Uk00MzXggf5nFH6CFBA9D5IJdag=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052