UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EndJt4krNBh/9qgHXENgIxJSyhNNhSgyoZTG638wCJ8='
WHERE
key_id = 'a1cb60489643668a957eb0b9342724862b0f33e146ae60cbebb4bb327546bdab'
AND (
token = 'EndJt4krNBh/9qgHXENgIxJSyhNNhSgyoZTG638wCJ8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)