UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'g6wm3C80kYZb+zG5ltI40VvSWsh2Uz7Zy1FaBJBdaCk='
WHERE
key_id = 'a7e9c34cc9f17dad22197baa82909e87ab31fb16fe502675e5c17e940b456737'
AND (
token = 'g6wm3C80kYZb+zG5ltI40VvSWsh2Uz7Zy1FaBJBdaCk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)