UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pu9YN+EnYwJeOaOlulw2/xo8OiBcrlGsTCB66eBuLqY='
WHERE
key_id = '89657fe3b4b640e0678894c791e97e303153e12e80610ffc0c26deee900602a7'
AND (
token = 'pu9YN+EnYwJeOaOlulw2/xo8OiBcrlGsTCB66eBuLqY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)