UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dTgONbnv8pNjcQbruXeUrLUH25iL2NRdp41iu8zXlIo='
WHERE
key_id = '59ed855d8177dfa1c449d5ad05043d79c90875f6bbe277bb2ae4bb826db57d36'
AND (
token = 'dTgONbnv8pNjcQbruXeUrLUH25iL2NRdp41iu8zXlIo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)