UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hnnWblmPiIsudckjzeDq9xh/mYGlZGyq17hkuXiV7DM='
WHERE
key_id = 'ded8d4e76a5915aa34e1fd56a0711ae8a1b4fcebcafffd15ef72ca79b2c31ae0'
AND (
token = 'hnnWblmPiIsudckjzeDq9xh/mYGlZGyq17hkuXiV7DM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)