UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N3kBxmIRRiqooRYYL1SowqmoIAeOR0JklPSlCm5t90w='
WHERE
key_id = '99d6a6b5048918f6dc7d339df7a62a52734d84e9c723c85b5c18403c2de14b30'
AND (
token = 'N3kBxmIRRiqooRYYL1SowqmoIAeOR0JklPSlCm5t90w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)