UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'W46sEpSAz2q8wVc3xLIdA46cu/VKG6dO+ezrO25//Y4='
WHERE
key_id = '86489d9508bb9d570169a1cf1d71b424b8e74419a7d6b7efb2e217d112d96bf1'
AND (
token = 'W46sEpSAz2q8wVc3xLIdA46cu/VKG6dO+ezrO25//Y4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)