UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KI5ZVg8gcqTJzIpHLzKUbWjIL1/Iu1rhgsYHrEI0HxE='
WHERE
key_id = 'd9c3273d0fab0e1b69d1ae9ed46e5f921e8e6c69ddbe2a2c1f5be27fc8c93681'
AND (
token = 'KI5ZVg8gcqTJzIpHLzKUbWjIL1/Iu1rhgsYHrEI0HxE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)