UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hnXw+BMbG1NNcmRi/B2RnD3/ntviHzfVuZIF/Ls3Foo='
WHERE
key_id = 'b259f42a543e25d106f6c8079b60804ed39437c2fac5bb68753b7feb115c7818'
AND (
token = 'hnXw+BMbG1NNcmRi/B2RnD3/ntviHzfVuZIF/Ls3Foo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)