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