UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QiWHA4EOwyoBnpPrLzuM8LHywMy9N7RUXMVOE2PwzPM='
WHERE
key_id = '8a9a2e99e6893823e9fe41d5bec37d8f0d47a01c9c2faea88aedce23deedfade'
AND (
token = 'QiWHA4EOwyoBnpPrLzuM8LHywMy9N7RUXMVOE2PwzPM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)