UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DSd0GVWlwTw6GHoOYji8k6awnZaXestYOpn4j24TNOw='
WHERE
key_id = '255efaf3ec0c32bba13cec148cf98013fc5b1d1b4f1b1e3caa46afde17e49f4a'
AND (
token = 'DSd0GVWlwTw6GHoOYji8k6awnZaXestYOpn4j24TNOw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)