UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '83WASVynsVZI6L+9Jp2eX8kr/9amTB7GWjRr0o/3bC4='
WHERE
key_id = 'f77652bbe7a8bafc57742dc7777ef63ff2f9c654ae89d7fc82b917d84f0065f1'
AND (
token = '83WASVynsVZI6L+9Jp2eX8kr/9amTB7GWjRr0o/3bC4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)