UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c0Ed7JyUwhb02Syy1vif0JULWAZuxQaHUZ3QhflLi/Q=' 
WHERE 
  key_id = 'e4ff16e0e2146c5898774d265dc95d9df344c2989d6691ca157d0dd30725411c' 
  AND (
    token = 'c0Ed7JyUwhb02Syy1vif0JULWAZuxQaHUZ3QhflLi/Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023