UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6pskP++OUhH6hOp+8C10hHhnCuySlOHeU7W5n9E6gv8='
WHERE
key_id = '998ff139360250a217b1d4e7d6c244f0a4506370255cfd9fda815896833b79b9'
AND (
token = '6pskP++OUhH6hOp+8C10hHhnCuySlOHeU7W5n9E6gv8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)