UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EYsT21J23C1IYq5x3z0GluVDo/2w7a4WSwXLL1A8aUk=' 
WHERE 
  key_id = '7f110e5b8836734019f0ccc415a39a0d51c4d33cdc9a53479b66a90ab52763d8' 
  AND (
    token = 'EYsT21J23C1IYq5x3z0GluVDo/2w7a4WSwXLL1A8aUk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044