UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0nF54FFoV6A4CN6FHCK9JfuNUPGWBgcmiKGMztqtwrg='
WHERE
key_id = 'd747819c79da68575d3540e83df5dd9ed5c97c14c48ceaabaeebcd5e9b18ff78'
AND (
token = '0nF54FFoV6A4CN6FHCK9JfuNUPGWBgcmiKGMztqtwrg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)