UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9vfSIe8sodCCz7ZWoULMmF5uSmpbmyScSUP2ZkEA7pc='
WHERE
key_id = 'dde9d397338c1bef73813b584cc30ef8a16572cc34d74e00ee4f9ca1aab010c3'
AND (
token = '9vfSIe8sodCCz7ZWoULMmF5uSmpbmyScSUP2ZkEA7pc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)