UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sEffjHRO8YwdTRcxjD5nBIEX6Jj8u/gB0k5GhcCARAA=' 
WHERE 
  key_id = 'a8e7b678da047d141a749ced528cc6455282034ecf77aac21fb4e8a224206436' 
  AND (
    token = 'sEffjHRO8YwdTRcxjD5nBIEX6Jj8u/gB0k5GhcCARAA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042