UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xlTrErfPmG0W4GJ91DKBLAbJwKmfEjTxt7U6msRd6Zc='
WHERE
key_id = '94678456f4a84c03ae1194838a445b0cd0329e46c729890c31c898f235e32eb4'
AND (
token = 'xlTrErfPmG0W4GJ91DKBLAbJwKmfEjTxt7U6msRd6Zc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)