UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hNIItqW2BeU+2wRsv4VSskY7B0PsWYeCByvw8LEcwyU='
WHERE
key_id = 'dd16529dffb0aab43c35eb0c600367d99f51eef2c8b238a699a49dde9d71b6f1'
AND (
token = 'hNIItqW2BeU+2wRsv4VSskY7B0PsWYeCByvw8LEcwyU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)