UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'z6qaApfz0XIcOvaEz+ipoxOigAH1ft0d6OpwDs7Ddx0='
WHERE
key_id = 'f8ebb932a2f0b30dd53e14547ed1c4dbc7c8da6da4f30d8ea8ba472a1acc1196'
AND (
token = 'z6qaApfz0XIcOvaEz+ipoxOigAH1ft0d6OpwDs7Ddx0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)