UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WyquHi6K+EEZudyAhB4KTaoyzx6OZ5GJ8b8u5RvtYMg=' 
WHERE 
  key_id = 'af6b9a248f9e541a6fbcc2d31467f191e5eb5ec5612c475f3096597a65b97463' 
  AND (
    token = 'WyquHi6K+EEZudyAhB4KTaoyzx6OZ5GJ8b8u5RvtYMg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026