UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zREwRQdzk4drVAbZqsVpwnAMQPRKgsT1iYaA7c5SUWA='
WHERE
key_id = '50e68ef4dd64992c34042f36187843a64bf6e91d2de087adf026e3f8493e5881'
AND (
token = 'zREwRQdzk4drVAbZqsVpwnAMQPRKgsT1iYaA7c5SUWA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)