UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+66tcCoe3plBlGJoOX4plxKhpcZ0rOuvp31wTuSRZ6A=' 
WHERE 
  key_id = '91d58beed219ddbba9c795e5de18252d178816e1fde7e813c73e0a3f196782bd' 
  AND (
    token = '+66tcCoe3plBlGJoOX4plxKhpcZ0rOuvp31wTuSRZ6A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032