UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Gw0R8mQTaBB4cZ0rW2EICaT+e8OqJq+PeNRn2Eb07AI='
WHERE
key_id = '2d83a953479f7decaef93f3aff63496023bacdf12a452581be4c3282959699d5'
AND (
token = 'Gw0R8mQTaBB4cZ0rW2EICaT+e8OqJq+PeNRn2Eb07AI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)