UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sc8jhOOlQKw7ogxDFRbuXzJqnD03+yYIYfSzk1QnmPI='
WHERE
key_id = 'b62529175473be3e13f81b0e8e0a69292bb57affb63a0cd3248bbd34a9807a09'
AND (
token = 'sc8jhOOlQKw7ogxDFRbuXzJqnD03+yYIYfSzk1QnmPI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)