UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OZqyZUCRTDyUNPdr7UqQKhyv6We4iUzdEL4dv465yqs='
WHERE
key_id = '85d84da11ec69b69b8922aa59cd35c39164a80e4d8b7f10d029c9af13ac9e706'
AND (
token = 'OZqyZUCRTDyUNPdr7UqQKhyv6We4iUzdEL4dv465yqs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)