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