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

Query time 0.00037