UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'waG3S2TaM4a1EXIq7BEvtx2z7M6VeHu2AEDkGgqVmOg='
WHERE
key_id = '86d3f1632a3f2176244c6a16740f2501f126d579e0deff1409f1772a9e58353a'
AND (
token = 'waG3S2TaM4a1EXIq7BEvtx2z7M6VeHu2AEDkGgqVmOg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)