UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'spCZAsBqmJetmkIk2yX79jOWZEVP31A7SHnfIxlkqiQ='
WHERE
key_id = 'd37b88bd6ef92b64dc58ade91800243d57d976e01cd30ec5ae3b51f40091339c'
AND (
token = 'spCZAsBqmJetmkIk2yX79jOWZEVP31A7SHnfIxlkqiQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)