UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'C8Wounsdm9Jqco1wev6S/JEYUyyTjuDk4rPuuccwAgQ='
WHERE
key_id = 'bc1bd77f736412c805870d7f9342649aee9d3a1dfcb0a3a063b3db081c761bb4'
AND (
token = 'C8Wounsdm9Jqco1wev6S/JEYUyyTjuDk4rPuuccwAgQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)